package com.ice.framework.dialog

import android.content.Context
import android.graphics.drawable.ColorDrawable
import android.view.Gravity
import android.view.LayoutInflater
import android.view.ViewGroup
import android.widget.PopupWindow
import com.ice.framework.R

class LoadingDialog:PopupWindow {

    private var parentView: ViewGroup

    constructor(context: Context,parentView:ViewGroup):super(context){
        this.parentView=parentView
        contentView= LayoutInflater.from(context).inflate(R.layout.dialog_loading,parentView,false)
        initView()
        width= ViewGroup.LayoutParams.WRAP_CONTENT
        isOutsideTouchable=false
        isFocusable=false
        setBackgroundDrawable(ColorDrawable(0x00000000))
    }

    private fun initView() {

    }

    fun show(){
        if(parentView.windowToken!=null){
            showAtLocation(parentView,Gravity.CENTER,0,0)
        }
    }
}
